package com.ergwang.servicebase.exceptionhandler;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author ergwang
 * @date 2020-12-22 21:55
 */

//@Data                // 生成get和set方法
//@AllArgsConstructor  //生成有参构造方法
//@NoArgsConstructor   // 生成无参构造
public class ErgwangException extends RuntimeException {

    /**
     * 异常的状态码
     */
    private Integer code;

    /**
     * 异常的详细信息
     */
    private String msg;

    public ErgwangException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ErgwangException(String message, Integer code, String msg) {
        super(message);
        this.code = code;
        this.msg = msg;
    }

    public ErgwangException(String message, Throwable cause, Integer code, String msg) {
        super(message, cause);
        this.code = code;
        this.msg = msg;
    }

    public ErgwangException(Throwable cause, Integer code, String msg) {
        super(cause);
        this.code = code;
        this.msg = msg;
    }

    public ErgwangException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Integer code, String msg) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
